package com.threads;

import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * @author 13699
 */
public class SleepingTask extends LiftOff{

    @Override
    public void run() {
        try {
            synchronized (SleepingTask.class) {
                while (countDown-- > 0) {
                    System.out.println(status());
                    TimeUnit.MILLISECONDS.sleep(100);
                }
            }
        }catch (InterruptedException e){
            System.out.println("Interruped");
        }
    }

    public static void main(String[] args) {
        ExecutorService exec= Executors.newCachedThreadPool();
        for (int i = 0; i < 5; i++) {
            exec.execute(new SleepingTask());
        }
        exec.shutdown();
    }
}
